//
//  STDIOSToCPPFuncs.h
//  STDRenderSDK
//
//  Created by 陈学明 on 2023/3/12.
//

#include <stdio.h>

// 创建引擎
void * stds_gl_createRenderEngine(void);

// 注册provider, provider 为 struct STDRenderEngineProvider 类型
void stds_gl_registerProvider(void *hander, const void *provider);

// 销毁引擎
void stds_gl_destroyRenderEngine(void *hander);


/// -------------------------------------------------------------- 合成相关 --------------------------------------------------------------
// 设置合成宽高
void stds_gl_setComposeSizeSRC(void *hander, int width, int height);

// 设置合成持续时间，duration 时长
void stds_gl_setComposeDuration(void *hander, float duration);

void stds_gl_testGl(void *hander);

/// -------------------------------------------------------------- 图层相关 --------------------------------------------------------------
// 添加图层
void stds_gl_addLayer(void *hander, int layerID, int type);

// 将图层加入到预合成层
void stds_gl_moveLayerToCompose(void *hander, int layerID, int composeID);

// 移除图层
void stds_gl_removeLayer(void *hander, int layerID);

// 将 layerID 图层移动到 targetLayerID 图层之上
void stds_gl_moveLayerToFront(void *hander, int composeID, int layerID, int targetLayerID);

// 将layerID 图层 移动到 targetLayerID 图层之下
void stds_gl_moveLayerToBack(void *hander, int composeID, int layerID, int targetLayerID);

// 将图层移动到最上面
void stds_gl_moveLayerToTop(void *hander, int composeID, int layerID);

// 将图层移动到最下面
void stds_gl_moveLayerToBottom(void *hander, int composeID, int layerID);

// 设置图层显示状态,0 不显示，1 显示
void stds_gl_visibleLayer(void *hander, int layerID, int isVisible);

// 设置图层生命周期，start 开始时间，duration 时长
void stds_gl_setLayerLife(void *hander, int layerID, float start, float duration);

// 设置图层的透明度，alpha 0～1
void stds_gl_setLayerAlpha(void *hander, int layerID, float alpha);

// 设置图层的混合模式
void stds_gl_setLayerBlend(void *hander, int layerID, int blendType);

// 设置图层大小
void stds_gl_setLayerSize(void *hander, int layerID, float w, float h);

// 设置图层中心位置
void stds_gl_setLayerCenter(void *hander, int layerID, float x, float y);

// 设置图层缩放
void stds_gl_setLayerScale(void *hander, int layerID, float x, float y);

// 设置图层旋转角度
void stds_gl_setLayerRotate(void *hander, int layerID, float angle);

// 设置图层是否自动大小
void stds_gl_setLayerAutoSize(void *hander, int layerID, bool autoW, bool autoH);

// 仿射变换-平移
void stds_gl_transformation_translationLayer(void *hander, int layerID, float dx, float dy);

// 放射变换-缩放
void stds_gl_transformation_scaleLayer(void *hander, int layerID, float dx, float dy);

// 仿射变换-旋转
void stds_gl_transformation_rotationLayer(void *hander, int layerID, float dAngle);
// 设置纯色层颜色
void stds_gl_setSolidLayerColor(void *hander, int layerId, float r, float g, float b);

/// -------------------------------------------------------------- 效果相关 --------------------------------------------------------------
// 给图层添加效果， effectType 效果类型
void stds_gl_addEffect(void *hander, int layerID, int effectType);

// 移除效果，effectType 效果类型
void stds_gl_removeEffect(void *hander, int layerID, int effectType);

// 调整效果的参数强度，effectType 效果类型，paramName 效果的参数名称, intensity 强度
void stds_gl_changeEffectFloatValue(void *hander, int layerID, int effectType, const char *paramName, float *floatValue, int n);

void stds_gl_changeEffectIntValue(void *hander, int layerID, int effectType, const char *paramName, int *intValue, int n);

void stds_gl_changeEffectStringValue(void *hander, int layerID, int effectType, const char *paramName, const char *stringValue);

void stds_gl_changeEffectBitmap(void *hander, int layerID, int effectType, const char *paramName, const char *data, int width, int height);

void stds_gl_changeEffectTex(void *hander, int layerID, int effectType, const char *paramName, unsigned int texId, int width, int height);

// 设置效果显示状态,isVisible 0 不显示，1 显示，effectType 效果类型
void stds_gl_visibleEffect(void *hander, int layerID, int effectType, int isVisible);

// 校验效果状态， label 标签
bool stds_gl_checkEffectStatus(void *hander, int layerID, int effectType, const char *label);

/// -------------------------------------------------------------- 热加载效果 --------------------------------------------------------------
// 添加热加载效果, effectName 热加载效果名称，effectRoot 效果的根目录
void stds_gl_addHotEffect(void *hander, int layerID, const char *effectName, const char *effectRoot);

// 移除效果，effectName 热加载效果名称
void stds_gl_removeHotEffect(void *hander, int layerID, const char *effectName);

// 给热加载效果设置参数
void stds_gl_changeHotEffectFloatValue(void *hander, int layerID, const char *effectName, const char *paramName, float *floatValue, int n);

void stds_gl_changeHotEffectIntValue(void *hander, int layerID, const char *effectName, const char *paramName, int *intValue, int n);

void stds_gl_changeHotEffectStringValue(void *hander, int layerID, const char *effectName, const char *paramName, const char *stringValue);

// 是否显示热加载效果
void stds_gl_visibleHotEffect(void *hander, int layerID, const char *effectName, int isVisible);

/// -------------------------------------------------------------- 热加载滤镜 --------------------------------------------------------------
// 添加热加载效果, effectName 热加载效果名称，effectRoot 效果的根目录
void stds_gl_addHotFilter(void *hander, int layerID, const char *filter, const char *effectRoot);

// 移除效果，effectName 热加载效果名称
void stds_gl_removeHotFilter(void *hander, int layerID, const char *filter);

// 给热加载效果设置参数
void stds_gl_changeHotFilterFloatValue(void *hander, int layerID, const char *filter, const char *effectName, const char *paramName, float *floatValue, int n);

void stds_gl_changeHotFilterIntValue(void *hander, int layerID, const char *filter, const char *effectName, const char *paramName, int *intValue, int n);

void stds_gl_changeHotFilterStringValue(void *hander, int layerID, const char *filter, const char *effectName, const char *paramName, const char *stringValue);

// 是否显示热加载效果
void stds_gl_visibleHotFilter(void *hander, int layerID, const char *filter, int isVisible);

/// -------------------------------------------------------------- 渲染相关 --------------------------------------------------------------
// 设置进度
void stds_gl_setCurrentPrograss(void *hander, float prograss);

// 渲染
void stds_gl_render(void *hander);
// readPixel
void stds_gl_readPixel(void *hander, int *width, int *height, unsigned char **data);


/// -------------------------------------------------------------- 替换资源 --------------------------------------------------------------
// 替换图片资源
void stds_gl_replaceImageAsset(void *hander, int layerId, int assetId, const char *path);

// 替换纹理
void stds_gl_replaceImageTex(void *hander, int layerId, int assetId, const unsigned int textureId, float width, float height);

// 替换图片数据
void stds_gl_replaceImageData(void *hander, int layerId, int assetId, const unsigned char *data, float width, float height);

void stds_gl_replaceMaskAsset(void *hander, int layerId, int assetId, const char *path);

void stds_gl_replaceMaskTex(void *hander, int layerId, int assetId, const unsigned int textureId, float width, float height);

void stds_gl_replaceMaskData(void *hander, int layerId, int assetId, const unsigned char *data, float width, float height);

